<?php require_once '../includes/config.php'; ?>

<?php

/* 
 * edits the admin price table values
 */

if(isset($_POST["edit"])){
    
    $id = filter_input(INPUT_POST, 'id');
    $size = filter_input(INPUT_POST, 'size');
    $price_1 = filter_input(INPUT_POST, 'price_1');
    $blprice_1 = filter_input(INPUT_POST, 'blprice_1');
    $blprice_2 = filter_input(INPUT_POST, 'blprice_2');
    $blprice_4 = filter_input(INPUT_POST, 'blprice_4');

/*
 * Debugging echos
 */
//    echo var_export($id);
//    echo var_export($size);
//    echo var_export($price_1);
//    echo var_export($price_2);
//    echo var_export($price_4);
    
    $result = query("UPDATE price_list SET size=?, price_1=?, blprice_1=?, blprice_2=?, blprice_4=? WHERE id=?",$size, $price_1, $blprice_1, $blprice_2, $blprice_4, $id);
    
    
    
    if($result !== false){
        header('Location: prices.php');
    }else{
        echo 'Query Failed!';
    }
}else{
    echo "filter_input(INPUT_POST, \'edit\') failed";
}
